package dk.mirasola.systemtraining.bridgewidgets.server.util;

import dk.mirasola.systemtraining.bridgewidgets.shared.model.Bid;
import dk.mirasola.systemtraining.bridgewidgets.shared.model.Card;
import dk.mirasola.systemtraining.bridgewidgets.shared.model.ContractBid;
import dk.mirasola.systemtraining.bridgewidgets.shared.model.Seat;
import dk.mirasola.systemtraining.bridgewidgets.shared.model.SpecialBid;
import dk.mirasola.systemtraining.bridgewidgets.shared.model.Suit;

import java.util.Random;


public class BridgeRandom {
    private static Random random = new Random(System.currentTimeMillis());

    public static Seat nextSeat() {
        return Seat.values()[random.nextInt(Seat.values().length)];
    }

    public static Suit nextSuit() {
        return Suit.values()[random.nextInt(Suit.values().length)];
    }

    public static Bid nextBid() {
        int id = random.nextInt(SpecialBid.values().length + ContractBid.values().length);
        if (id < ContractBid.values().length) {
            return ContractBid.values()[id];
        } else {
            return SpecialBid.values()[id - ContractBid.values().length];
        }
    }

    public static Card nextCard() {
        return Card.values()[random.nextInt(Card.values().length)];

    }

    private BridgeRandom() {
    }
}
